/**
 @Name：CLTPHP 网站设置
 @Author：chichu
 @Site：http://www.cltphp.com/admin/
 @License：LPPL
 */

layui.define(['form', 'upload'], function (exports) {
    var $ = layui.$
        , layer = layui.layer
        , admin = layui.admin
        , form = layui.form;
    var $body = $('body');
    //网站设置
    form.on('submit(set_website)', function (obj) {
        admin.req({
            url: '/shengteng/system/websiteEdit/'
            , data: obj.field
            ,type:'post'
            , done: function (res) {
                layer.msg(res.msg, {icon: 1, time: 1000});
            }
        });
        return false;
    });
    //邮件服务
    form.on('submit(set_system_email)', function (obj) {
        //提交修改
        admin.req({
            url: '/shengteng/system/email/'
            , data: obj.field
            ,type:'post'
            , done: function (res) {
                layer.msg(res.msg, {icon: 1, time: 1000});
            }
        });
        return false;
    });
    //发送测试邮件
    form.on('submit(trySend)', function (obj) {
        admin.req({
            url: '/shengteng/system/trySend/'
            , data: obj.field
            ,type:'post'
            , done: function (res) {
                layer.msg(res.msg, {icon: 1, time: 1000});
            }
        });
        return false;
    });
    //对外暴露的接口
    exports('system', {});
});
